<!DOCTYPE html>

{% load filters %}   {# 引入过滤器 #}

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Students</title>
</head>
<body>
             {{ 19|mySub:9 }}
            {% if 18|ifEven %}
                <h1>18 is a even</h1>
            {% endif %}



            <h1>Students Infomation</h1>
            <ul>
                    <li>{{ year }}</li>
                    {%  for student in studentList  %}
                        <li>{{ student.name }}--{{ student.grade }}--{{ student.age }}</li>
                        <li>{{ student.duty }}</li>
                        {#  在模板中调用对象的方法, 但是不能给函数传参数   #}
                    {% endfor %}
                    <li>*{{ name }}*</li>
            </ul>

{#  分页   #}
             {% if studentList.has_previous %}
                 <a href="/pageStudent/{{ studentList.previous_page_number }}">
                     上一页
                 </a>
             {% endif %}
            {% for pageNum in studentList.paginator.page_range %}
{#                <li>{{ pageNum }}</li>#}
                {% if pageNum == studentList.number %}
                    {{ pageNum }}
                {% else %}
                    <a href="/pageStudent/{{ pageNum }}">{{ pageNum }}</a>
                {% endif %}
            {% endfor %}
             {% if studentList.has_next %}
                 <a href="/pageStudent/{{ studentList.next_page_number }}">
                     下一页
                 </a>
            {% endif %}
</body>
</html>